<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>自定义指令</title>
</head>
<body ng-app="app">
	<div ng-controller="ctrl">
		<!--属性的名字由驼峰命名法的指令名转换而来-->
		<div my-say-hello></div>
	</div>

	<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.7/angular.js"></script>
	<script>
		let app = angular.module("app", []);
		//参数：指令的名称，指令的工厂函数，返回一个包含template、replace、restrict属性的对象
		app.directive("mySayHello", () => {
			return {
				//定义指令的模版
				template: "<p>hello world</p>",
				//定义是插入还是替换
				replace: false
			}
		});
	</script>
</body>
</html>
